<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/6/20 0020
 * Time: 下午 2:07
 */

namespace app\socket\controller;


use app\common\model\Device;
use app\common\model\Msg;

class Httpd
{
    function index(){
        $me = input('device_me');
        if(empty($me)){
            return json(["code"=>1008,"msg"=>'device_me  not found']);
        }
        $device = Device::get(["device_me"=>$me]);
        if(empty($device)){
            return json(["code"=>1008,"msg"=>'device_me  not found']);
        }
        $msg = Msg::pop_device_msg($device->id);
        if(!empty($msg)){
            $push = $msg->push_msg;
            return json(["code"=>1000,"msg"=>'成功',data=>$push]);
        }
        return json(["code"=>1000,"msg"=>'成功',data=>'']);
    }
}